<?php

namespace Modules\Asset\Entities;

use Modules\Core\Entities\BaseEntity as Model;
use ThrowException;
use Setting;

// use Modules\Asset\Entities\ResaleRecord;

use Modules\Order\Traits\Skuable;
use Asset;

// 福袋资产
class RedpackSku extends Model
{
    use Skuable;

    protected $guarded = [];
    protected $table = 'asset_redpack_skus';
    static public $resourceName = '';

    // protected $appends = ['union_status', 'union_status_text', 'sku_type_text', 'sid'];

    protected $casts = [
    ];

    public function getTitleAttribute()
    {
    	return $this->redpack / 100 . '余额';
    }

    public function getType($type) 
    {
        $map = [
            'base_sku_type' => 'redpack_sku',
            'node_type' => 'redpack_sku'
        ];

        return @$map[$type];
    }

    public function getNodeEntity() 
    {
        return $this;
    }

    // 订单平台资产
    public function getOrderAssets()
    {
        return [
            'is_redpack' => 1,
            'redpack' => $this->redpack
        ];
    }
}
